import request from '@/utils/request'

export function getCategoryList() {
    return request({
        url: '/admin/courses/listSubject', // 替换为你的实际API路径
        method: 'get'
    })
}

export function addSubject({ name, parentId }) {
    return request({
        url: '/admin/courses/addSubject',
        method: 'post',
        data: { name, parentId }, // 明确传递对象格式
        headers: {
            'Content-Type': 'application/json' // 必须设置JSON格式
        }
    })
}

export function updateSubject(data) {
    return request({
        url: '/admin/courses/updateSubject',
        method: 'put',
        data
    })
}

export function deleteSubject(id) {
    return request({
        url: `/admin/courses/deleteSubject/${id}`,
        method: 'delete'
    })
}
